package br.domsd.pocketcontrol.action;

import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.sax.StartElementListener;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.TextView;
import br.domsd.pocketcontrol.MainActivity;
import br.domsd.pocketcontrol.MonthExpensesActivity;

public class MonthExpensesListViewActionListener implements OnClickListener, android.view.View.OnClickListener, OnItemClickListener
{
	
	MainActivity mainActivity;
	
	public MonthExpensesListViewActionListener(MainActivity mainActivity)
	{
		this.mainActivity = mainActivity;
	}

	public void onItemClick(AdapterView<?> adapterView, View arg1, int itemPosition, long arg3)
	{
		Log.d(MonthExpensesListViewActionListener.class.getSimpleName(), "Item clicked: " + adapterView.getItemAtPosition(itemPosition));
		
		String fileName = adapterView.getItemAtPosition(itemPosition).toString();
		
		Intent monthExpensesActivity = new Intent(mainActivity, MonthExpensesActivity.class);
		monthExpensesActivity.putExtra("openedPeriod", fileName);
		
		mainActivity.startActivity(monthExpensesActivity);
	}

	public void onClick(View v)
	{
	}

	public void onClick(DialogInterface dialog, int which)
	{
	}
	
}
